package com.hellloop.pim.alphabeat.entity;

import java.util.Hashtable;

import com.hellloop.pim.alphabeat.type.RoomState;

public class LivingRoomEntity {
	Hashtable<Integer, Player> players;
	Player roomOwner = null;
	
	RoomState roomState = RoomState.inTheLivingRoom;
	RoomProperties roomProperties = null;
	
	public LivingRoomEntity() {
		players = new Hashtable<Integer, Player>();
	}
	
	public void setRoomState( RoomState roomState) { this.roomState = roomState;}
	public RoomState getRoomState() { return roomState;}

	public Player getPlayer( int playerId) {
		return players.get(new Integer(playerId));
	}

	public Hashtable<Integer, Player> getPlayers() { return players;}

	private void addPlayer( Player player) {
		this.players.put( new Integer(player.getPlayerId()), player);
	}
	
	public void setRoomOwner( int ownerId) {
		roomOwner = players.get(new Integer(ownerId));
	}
	
	public void setRoomProperties( RoomProperties rp) {
		roomProperties = rp;
	}
	public RoomProperties getRoomProperties() {
		return roomProperties;
	}
	
	public void setPlayerList(Player[] playerList){
		players.clear();
		for(Player p : playerList){
			addPlayer(p);
		}
	}
}
